package com.sumainfor.pc.gmio.service.impl;

import com.sumainfor.common.Constants;
import com.sumainfor.common.util.JsonResult;
import com.sumainfor.common.utlis.ComUtils;
import com.sumainfor.common.utlis.ParamsCommon;
import com.sumainfor.pc.gmio.dao.EpcProviderMapper;
import com.sumainfor.pc.gmio.service.EpcProviderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.Map;

/**
 * @Author Eddy·Chen
 * @Email 835033913@qq.com
 * @Create 2019-04-09 19:28
 * 工程部服务提供者
 */
@Service
public class EpcProviderServiceImpl implements EpcProviderService {

    @Autowired
    private EpcProviderMapper mapper;

    @Autowired
    private ComUtils comUtils;

    /**
     * 添加打款订单
     *
     * @param params
     * @return
     */
    @Override
    public JsonResult insertOutOrder(Map<String, Object> params) {
        String id = comUtils.getLocalTrmSeqNumByLook("ZDZC", Constants.DATA_SOURCE_GMIO, "tcgmio_bill_outlay", "BiOutId");
        params.put("BiOutId", id);
        params.put("LateDay", new Date((Long) params.get("LateDay")));
        params.put("StartTime", new Date((Long) params.get("StartTime")));
        ParamsCommon.commonInsertParms(params, getClass());
        int row = mapper.insertOutOrder(params);
        return row <= 0 ? JsonResult.actionFailure() : JsonResult.actionSuccess();
    }

}
